package com.ap.core.common.types;

import com.ap.core.cxf.jaxb.msghdr.MessageType;

/**
 * User: Rohit.Dixit
 */
public enum ServiceMessageType {

	GETACCFORREFUND("GETACCFORREFUND", "ManageDistributor_1.notifyPayment_1",
			OperationNameCode.NOTIFY_REFUND_INITIATION, SystemTypeCode.FI);

	private String inputMsgTypeEnum;
	private String destinationService;
	private OperationNameCode operationName;
	private SystemTypeCode destinationType;

	private ServiceMessageType(String inputMsgTypeEnum,
			String destinationService, OperationNameCode operationName,
			SystemTypeCode destinationType) {
		this.inputMsgTypeEnum = inputMsgTypeEnum;
		this.destinationService = destinationService;
		this.operationName = operationName;
		this.destinationType = destinationType;
	}

	public String getInputMsgTypeEnum() {
		return inputMsgTypeEnum;
	}

	public static ServiceMessageType getMessageType(String msgType) {

		ServiceMessageType inputMessageType = null;
		switch (msgType) {
		case "GETACCFORREFUND":
			inputMessageType = ServiceMessageType.GETACCFORREFUND;
			break;
		default:
			// not found
			throw new IllegalArgumentException(
					"Unable to determine message type: inputMsgType= "
							+ inputMessageType);
		}
		return inputMessageType;
	}

	public static ServiceMessageType getMessageType(MessageType msgTypeEnum) {

		ServiceMessageType inputMessageType = null;
		switch (msgTypeEnum) {
		case GETACCFORREFUND:
			inputMessageType = ServiceMessageType.GETACCFORREFUND;
			break;
		default:
			// not found
			throw new IllegalArgumentException(
					"Unable to determine message type: inputMsgType= "
							+ inputMessageType);
		}
		return inputMessageType;
	}

	public String getDestinationService() {
		return destinationService;
	}

	public void setDestinationService(String destinationService) {
		this.destinationService = destinationService;
	}

	public OperationNameCode getOperationName() {
		return operationName;
	}

	public void setOperationName(OperationNameCode operationName) {
		this.operationName = operationName;
	}

	public SystemTypeCode getDestinationType() {
		return destinationType;
	}

	public void setDestinationType(SystemTypeCode destinationType) {
		this.destinationType = destinationType;
	}

}
